<template>
	<BaseContainer>
		<aplid-base-crud ref="crud" class="w-100" v-bind="baseConfig" :operateFormate="operateFormate">
			<template v-slot:FlowChartDialog="{ row, show }">
				<FlowChart @refresh="handleRefresh" :api="baseConfig.api" :key="show" :nowRowData="row"></FlowChart>
			</template>
		</aplid-base-crud>
	</BaseContainer>
</template>

<script setup lang="ts">
import { ElMessage } from 'element-plus'
import { baseConfig } from './config'
import FlowChart from './FlowChart/index.vue'
import apiMod from '@/apiMod'

const crud = ref()
const handleRefresh = () => {
	nextTick(() => {
		crud.value.refreshChange()
	})
}
const operateFormate = (form, type) => {
	return new Promise((resolve) => {
		if (type == 'deploy') {
			apiMod.act_model_deploy(form.id).then((res) => {
				ElMessage.success('操作成功')
				handleRefresh()
			})
			return
		} else {
			resolve(form)
		}
	})
}
</script>

<style scoped></style>
